package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.ConsultantLevel;
import com.hs.mapper.ConsultantLevelMapper;
import com.hs.service.ConsultantLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultantLevelServiceImpl implements ConsultantLevelService {
    @Autowired
    private ConsultantLevelMapper consultantLevelMapper;

    @Override
    public Integer addConsultantLevel(ConsultantLevel consultantLevel) {
        return consultantLevelMapper.addConsultantLevel(consultantLevel);
    }

    @Override
    public Integer deleteConsultantLevel(Integer id) {
        return consultantLevelMapper.deleteConsultantLevel(id);
    }

    @Override
    public Integer updateConsultantLevel(ConsultantLevel consultantLevel) {
        return consultantLevelMapper.updateConsultantLevel(consultantLevel);
    }

    @Override
    public ConsultantLevel getConsultantLevelById(Integer id) {
        return consultantLevelMapper.getConsultantLevelById(id);
    }

    @Override
    public PageInfo<ConsultantLevel> getConsultantLevelPages(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ConsultantLevel> consultantLevelPage = consultantLevelMapper.getConsultantLevelPage();
        PageInfo<ConsultantLevel> pageInfo = new PageInfo<>(consultantLevelPage);
        return pageInfo;
    }
}
